package com.sys.mapper;

import com.sys.entity.BizTask;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BizTaskMapper {
    List<BizTask> findTasks(@Param("domain") String domain,
            @Param("difficulty") Integer difficulty,
            @Param("age") Integer age,
            @Param("pageNum") Integer pageNum,
            @Param("pageSize") Integer pageSize,
            @Param("offset") Integer offset);

    long countTasks(@Param("domain") String domain,
            @Param("difficulty") Integer difficulty,
            @Param("age") Integer age);

    @Select("SELECT * FROM biz_task WHERE domain = #{domain} AND del_flag = 0")
    List<BizTask> findByDomain(@Param("domain") String domain);

    @Select("SELECT * FROM biz_task WHERE id = #{id} AND del_flag = 0")
    BizTask selectById(@Param("id") Long id);

    void save(BizTask task);

    void saveBatch(List<BizTask> tasks);
}